From 55121cdb79403ef434712b6b09eab105e1bca897 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 26 Nov 2010 14:21:33 +0000 Subject: [PATCH] xenpaging: when populating a page, check if populating is already in progress p2m_mem_paging_populate can be called serveral times from different vcpus. If the page is already in state p2m_ram_paging_in and has a new valid mfn, invalidating this new mfn will cause trouble later if p2m_mem_paging_resume will set the new gfn/mfn pair back to state p2m_ram_rw. Detect this situation and keep p2m state if the page is in the process of being still paged-out or already paged-in. In fact, p2m state p2m_ram_paged is the only state where the mfn type can be invalidated. Signed-off-by: Olaf Hering --- xen/arch/x86/mm/p2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 847a59ad66..d7da4ad1f2 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2767,7 +2767,7 @@ void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn) /* XXX: It seems inefficient to have this here, as it's only needed * in one case (ept guest accessing paging out page) */ gfn_to_mfn(p2m, gfn, &p2mt); - if ( p2mt != p2m_ram_paging_out ) + if ( p2mt == p2m_ram_paged ) { p2m_lock(p2m); set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paging_in_start); -- 2.30.2